package org.example.servlet_01;

import jakarta.servlet.*;

import java.io.IOException;

 /*
    在web.xml中配置
 */
public class demo2 implements Servlet {
    @Override
    public void init(ServletConfig config) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    //提供服务的方法
    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        System.out.println("demo2：Hello Servlet！！");
        res.setContentType("text/html;charset=UTF-8");
        res.getWriter().println("<h1>Hello Servlet_02!!!</h1>");
    }

    @Override
    public String getServletInfo() {
        return "";
    }

    @Override
    public void destroy() {

    }
}
